# 1.2变量和字符串
# 1.2.1变量
a = 4
b = 5
t = a
a = b
b = t
print(a, b)

# 1.2.2字符串的‘加法‘和’乘法‘
a = 'I'
b = " love"
c = " Python"
print(a + b + c)
print(b * 3)

# 1.2.3字符串的切片和索引
a = 'I love you'
print(a[0])
print(a[0:5])
print(a[-1])

# 1.2.4字符串方法
a = " www.baidu.com "
print(a.split("."))
print(a.replace("www", "suyanlong"))
print(a.strip())  # 删除两侧的空格不包括内部
print(a.strip(" !"))  # 删除两侧的 字符

a = "{} is my {} {}".format("Python", "love", "Yes")
print(a)

# 1.3函数控制语句
# 1.3.1函数
# def function(a, b):
# return print(1 / 2 * a * b)


function(3, 4)


def change_number(number):
    hiding_number = number.replace(number[3:7], "*" * 4)
    print(hiding_number)


change_number('15930154459')


# 1.3.2判断语句
def count_login():
    password = input("password:")
    if password == '123456':
        print("密码正确！")
    else:
        print("密码错误！！重新输入")
        count_login()


# count_login()
# 1.3.3循环语句
for i in range(1, 5):
    print(i)

i = 0
sum = 0
while i < 100:
    i += 1
    sum += i

print(sum)

import re

a = 'xxIxxjshdxxlovexxsffaxxpythonxx'
infos = re.findall('xx(.*?)xx', a)
print(infos)
